package cn.zm.app.serviceImpl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import cn.zm.app.dao.CategoryMapper;
import cn.zm.app.pojo.AppCategory;
import cn.zm.app.pojo.AppInfo;
import cn.zm.app.pojo.AppVersion;
import cn.zm.app.pojo.DataDictionary;
import cn.zm.app.service.CategoryService;

@Service
public class CategoryServiceImpl implements CategoryService{
	
	@Resource
	private CategoryMapper categoryMapper;

	/*
	 * 查询一级目录
	 */
	public List<AppCategory> categoryList1() {
		return categoryMapper.categoryList1();
	}

	/*
	 * 查询二级目录
	 */
	public List<AppCategory> categoryList2() {
		return categoryMapper.categoryList2();
	}

	/*
	 * 查询三级目录
	 */
	public List<AppCategory> categoryList3() {
		return categoryMapper.categoryList3();
	}

	/*
	 * 查询查询所属平台
	 */
	public List<DataDictionary> dictionaryList1() {
		return categoryMapper.dictionaryList1();
	}

	/*
	 * 查询APP状态
	 */
	public List<DataDictionary> dictionaryList2() {
		return categoryMapper.dictionaryList2();
	}
	
	
	/*
	 * 上级联动 查询下级目录
	 */
	public List<AppCategory> linkage1(List<String> pid) {
		return categoryMapper.linkage1(pid);
	}

	/*
	 * 下级联动 查询上级目录
	 */
	public List<AppCategory> linkage2(String pid) {
		return categoryMapper.linkage2(pid);
	}

	/*
	 * 查询总数量
	 */
	public int selectCount(String softwareName, String status,
			String categoryLevel1, String categoryLevel2,
			String categoryLevel3, String flatformId, String devId) {
		
		return 
		categoryMapper.selectCount(softwareName, status, categoryLevel1, categoryLevel2, categoryLevel3, flatformId, devId);
	}

	/*
	 * 查询集合
	 */
	public List<AppInfo> appInfoList(String softwareName, String status,
			String categoryLevel1, String categoryLevel2,
			String categoryLevel3, String flatformId, String devId,
			int numbs,int pageSize) {
		
		return
		categoryMapper.appInfoList(softwareName, status, categoryLevel1, categoryLevel2, categoryLevel3, flatformId, devId, numbs, pageSize);
	}

	/*
	 * 查询apkName是否存在
	 */
	public AppInfo toValidateName(String apkName) {
		return categoryMapper.toValidateName(apkName);
	}

	/*
	 * 新增appInfo信息
	 */
	public int toaddAppInfo(AppInfo app) {
		
		return categoryMapper.toaddAppInfo(app);
	}
	
	/*
	 * 根据id查询信息
	 */
	public AppInfo selectbyId(int id){
		return categoryMapper.selectbyId(id);
	}
	
	/*
	 * 修改AppInfo
	 */
	public int updatebyId(AppInfo appinfo){
		return categoryMapper.updatebyId(appinfo);
	}

	/*
	 * 查询版本信息集合
	 */
	public List<AppVersion> viewAppVersions(String id) {
		return categoryMapper.selectAppVersions(id);
	}

	/*
	 * 新增版本信息
	 */
	public int addAppVersion(AppVersion av) {		
		return categoryMapper.insertAppVersion(av);
	}

	/*
	 * 查询id根据appid
	 */
	public int viewAppVersionId(String id) {
		return categoryMapper.selectAppVersionId(id);
	}

	/*
	 * 根据id更新appid
	 */
	public int modifyAppVersionId(String id, String appid) {
		return categoryMapper.updateAppVersionId(id, appid);
	}

	/*
	 * 根据版本id查询版本信息
	 */
	public AppVersion viewAppVersionById(String id) {
		return categoryMapper.selectAppVersionById(id);
	}

	/*
	 * 修改版本信息
	 */
	public int modifyAppVersion(AppVersion appver) {		
		return categoryMapper.updateAppVersion(appver);
	}

	/*
	 * 查看信息
	 */
	public AppInfo viewAppInfo(String id) {
		return categoryMapper.selectAppInfo(id);
	}

	/*
	 * 删除版本通过appid
	 */
	public int modifyAppVersion(String id) {
		return categoryMapper.deleteAppVersion(id);
	}

	/*
	 * 删除appinfo通过id
	 */
	public int modifyAppInfo(String id) {
		return categoryMapper.deleteAppInfo(id);
	}
	
	
	
	
	
}
